package com.gxa.web_admin.controller.operationscontroller;

import com.gxa.common.R;
import com.gxa.modules.pojo.CarBill;
import com.gxa.modules.pojo.Contract;
import com.gxa.modules.service.operationsservice.HLCarPayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.lang.reflect.Array;
import java.util.Map;

/**
 * @Author hl
 * Date 2022/5/10 12:18
 */
@Api(value = "账单管理", tags = "账单管理-车辆缴费账单接口API_hl")
@RestController
@RequestMapping("/carPay")
@SuppressWarnings("all")
public class HLCarPayController {

    @Autowired
    HLCarPayService hlCarPayService;

    /**
     * 新增车辆账单接口
     *
     * @return 返回一个R对象
     */
    @RequestMapping(value = "/addCarPayInfo", method = RequestMethod.POST)
    @ApiOperation(value = "新增车辆账单接口-hl", notes = "新增车辆账单", httpMethod = "POST", response = Map.class)
    public R addCarPayInfo(@RequestBody CarBill carBill) {
        return hlCarPayService.addCarPayInfo(carBill);
    }

    /**
     * 修改车辆账单接口
     *
     * @return 返回一个R对象
     */
    @RequestMapping(value = "/updateCarPayInfoById", method = RequestMethod.POST)
    @ApiOperation(value = "修改车辆账单根据车辆账单id接口-hl", notes = "修改车辆账单", httpMethod = "POST", response = Map.class)
    public R updateCarPayInfoById(@RequestBody CarBill carBill) {
        return hlCarPayService.updateCarPayInfoById(carBill);
    }

    /**
     * 查询车辆账单接口
     *
     * @return 返回一个R对象
     */
    @RequestMapping(value = "/selectCarPayInfo", method = RequestMethod.GET)
    @ApiOperation(value = "查询车辆账单接口-hl", notes = "查询车辆账单", httpMethod = "GET", response = Map.class)
    public R selectCarPayInfo(String carNumber, String linkWay, String carType, @RequestParam String page,@RequestParam String limit) {
        return hlCarPayService.selectCarPayInfo(carNumber, linkWay, carType, Integer.parseInt(page), Integer.parseInt(limit));
    }

    /**
     * 查询车辆账单详情接口
     *
     * @return 返回一个R对象
     */
    @RequestMapping(value = "/selectCarPayInfoById", method = RequestMethod.GET)
    @ApiOperation(value = "查询车辆账单详情接口-hl", notes = "查询车辆账单详情", httpMethod = "GET", response = Map.class)
    public R selectCarPayInfoById(int id,String carNumber) {
        return hlCarPayService.selectCarPayInfoById(id,carNumber);
    }
    /**
     * 删除车辆账单接口
     *
     * @return 返回一个R对象
     */
    @RequestMapping(value = "/deleteCarPayInfoById", method = RequestMethod.POST)
    @ApiOperation(value = "根据车辆id删除车辆账单接口-hl", notes = "根据车辆id删除车辆账单", httpMethod = "POST", response = Map.class)
    public R deleteCarPayInfoById(String ids) {
        return hlCarPayService.deleteCarPayInfoById(ids);
    }
}
